<script setup lang="ts">
import { ref } from 'vue'
import { RouterLink } from 'vue-router';
import {data} from '@/stores/data'
import router from '@/router';
// const Props=defineProps(['username'])
const username = ref('')
const password=ref('')
function Login(){
    console.log(data.username)
    console.log(username.value)
    console.log(data.username===username.value)
    console.log(username.value === data.username && password.value === data.password)
    if(username.value === data.username && password.value === data.password){
        router.push('/home')
    }else{
        alert("用户名或密码错误")
    }
}
</script>


<template>

    <div style="display: flex;flex-direction: column;box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);padding: 20px;border-radius: 10px;position: relative;;left: 45%;margin-top: 50px">
        <input type="text" v-model="username" style="margin-top: 30px;height: 50px;width: 300px;"placeholder='请输入用户名'>
        <input type="password" v-model="password" style="margin-top: 30px;height: 50px;width: 300px;" placeholder="请输入密码">
        <input @click="Login()" type="button"  style="margin-top: 30px;height: 50px;width: 300px;background-color: aqua;color: white;cursor: pointer;" value="登录">
        <RouterLink to="/submit">未有账号？点此注册</RouterLink>
    </div>

</template>